#ifndef DATABASE_H
#define DATABASE_H


#include <odbx.h>

#include <string>
#include <iostream>
#include <fstream>
#include <boost/algorithm/string/trim.hpp>
#include <time.h>
#include <string>


#include "message.h"
#include "object.h"
#include "objectManager.h"
#include "networkBasics.h"



using namespace std;


class objectManager;   // chicken-egg-problem




class database : networkBasics {


    public:

        database();

		void Init(string pHost, string pUser, string pPass, string pName);
		void IntroduceMessage(message *pMsgSystem);
		void IntroduceObjManager(objectManager *pObjManager);
		void Connect(void);
		void Trennen(void);
		void InsertLog(int event_id, string message);
		void InsertClassicLog(string message);
		void checkDatabase(bool pInit);
		void getValueByID(bool pInit);

         int checkLogin(string name, string pass);


         StructMsgShowCharacters getCharacters(int AccountID);



		bool debug;


    protected:
    private:


        bool isConnected;


    string TrimSpaces( string pString);

        int sqlCount(string pField, string pStatement);
        int checkLoginGetUserID(string pUser, string pPass);
//     string sqlGetPlayerName(int pPlayerID);



        // Datenbank
        string DBhost, DBuser, DBpass, DBname;
        odbx_t* dbHandle;


        // pointer
        message *msgSystem;
        objectManager *objManager;


};

#endif // database_H
